home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 July: Mac OS SDK / Dev.CD Jul 96 SDK / Dev.CD Jul 96 SDK1.toast / Development Kits (Disc 1) / OpenDoc Development Framework / ODFDev / ODF / OS / FWGraphx / Include / SLBitmap.h < prev    next >
Encoding:
Text File  |  1996-04-25  |  5.2 KB  |  198 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                SLBitmap.h
  4. //    Release Version:    $ ODF 1 $
  5. //
  6. //    Copyright:    (c) 1993 -1996 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9.  
  10. #ifndef SLBITMAP_H
  11. #define SLBITMAP_H
  12.  
  13. #ifndef FWSTDDEF_H
  14. #include "FWStdDef.h"
  15. #endif
  16.  
  17. #ifndef SLGRDEF_H
  18. #include "SLGrDef.h"
  19. #endif
  20.  
  21. #ifndef SLPTRECT_H
  22. #include "SLPtRect.h"
  23. #endif
  24.  
  25. #ifndef SLPICTUR_H
  26. #include "SLPictur.h"
  27. #endif
  28.  
  29. #ifndef SLPALETE_H
  30. #include "SLPalete.h"
  31. #endif
  32.  
  33. #ifndef SLSTRMRW_H
  34. #include "SLStrmRW.h"
  35. #endif
  36.  
  37. //========================================================================================
  38. //    Forward Declarations
  39. //========================================================================================
  40.  
  41. class FW_OResourceFile;
  42. struct FW_SGraphicContext;
  43.  
  44. //========================================================================================
  45. // Bitmap
  46. //========================================================================================
  47.  
  48. class FW_CPrivBitmapRep;
  49. typedef FW_CPrivBitmapRep* FW_HBitmap;
  50.  
  51. // Export or Import functions for CFM-68K [sfu]
  52.  
  53. #if defined(FW_ODFLIB_IMPORT)
  54. #pragma import on
  55. #elif defined(FW_ODFLIB)
  56. #pragma export on
  57. #endif
  58.  
  59. FW_EXTERN_C_BEGIN
  60.  
  61. // Creation
  62.  
  63. FW_HBitmap            SL_API    FW_PrivBitmap_CreateFromBits(
  64.                                 short width, short height, short pixelSize, FW_Palette palette,
  65.                                 void* image, long imageSize, short rowBytes,
  66.                                 FW_PlatformError* error);
  67.  
  68. FW_HBitmap            SL_API    FW_PrivBitmap_CreateFromPlatformBitmap(
  69.                                 FW_PlatformBitmap    platformBitmap,
  70.                                 FW_PlatformError*    error);
  71.  
  72. FW_HBitmap            SL_API    FW_PrivBitmap_CreateFromResource(
  73.                                 FW_OResourceFile*    resourceFile,
  74.                                 FW_ResourceId        resId,
  75.                                 FW_PlatformError*    error);
  76.  
  77. FW_HBitmap            SL_API    FW_PrivBitmap_Copy(FW_HBitmap bitmap,
  78.                                 const FW_SRect&        srcRect,
  79.                                 FW_PlatformError*    error);
  80.  
  81. // Common operations
  82.  
  83. FW_Boolean            SL_API    FW_PrivBitmap_IsEqual(FW_HBitmap bitmap, 
  84.                                 FW_HBitmap bitmap2);
  85.  
  86. // Streaming
  87.  
  88. FW_HBitmap            SL_API    FW_PrivBitmap_Read(
  89.                                 FW_HReadableStream    stream,
  90.                                 FW_Boolean             bDIBFileHeader,
  91.                                 FW_PlatformError*     error);
  92.     
  93. void                SL_API    FW_PrivBitmap_Write(FW_HBitmap bitmap,
  94.                                 FW_HWritableStream    stream,
  95.                                 FW_Boolean             bDIBFileHeader,
  96.                                 FW_PlatformError*    error);
  97.  
  98. // Reference counting
  99.  
  100. void                SL_API    FW_PrivBitmap_Acquire(FW_HBitmap bitmap);
  101. long                SL_API    FW_PrivBitmap_GetRefCount(FW_HBitmap bitmap);
  102. void                SL_API    FW_PrivBitmap_Release(FW_HBitmap bitmap);
  103.  
  104. // Handle operations
  105.  
  106. FW_PlatformBitmap    SL_API    FW_PrivBitmap_GetPlatformBitmap(FW_HBitmap bitmap);
  107. FW_Boolean            SL_API    FW_PrivBitmap_IsPlatformBitmapOrphan(FW_HBitmap bitmap);
  108. FW_PlatformBitmap    SL_API    FW_PrivBitmap_OrphanPlatformBitmap(FW_HBitmap bitmap);
  109.     
  110. FW_PlatformError    SL_API    FW_PrivBitmap_SetPlatformBitmap(FW_HBitmap bitmap, 
  111.                                 FW_PlatformBitmap newBitmap);
  112. FW_PlatformError    SL_API    FW_PrivBitmap_AdoptPlatformBitmap(FW_HBitmap bitmap, 
  113.                                 FW_PlatformBitmap newBitmap);
  114.  
  115. // Palette
  116.     
  117. FW_Palette            SL_API    FW_PrivBitmap_GetPalette(FW_HBitmap bitmap, 
  118.                                 FW_PlatformError* error); 
  119. FW_PlatformError    SL_API    FW_PrivBitmap_SetPalette(FW_HBitmap bitmap, 
  120.                                 FW_Palette palette);
  121.  
  122. // Bitmap info
  123.  
  124. FW_PlatformError    SL_API    FW_PrivBitmap_GetBitmapInfo(FW_HBitmap     bitmap,
  125.                                 short&        width,
  126.                                 short&        height, 
  127.                                 short&        rowBytes,
  128.                                 short&        pixelSize);
  129.  
  130. void                SL_API    FW_PrivBitmap_GetBitmapBoundsGC(Environment* ev, 
  131.                                 FW_HBitmap bitmap, 
  132.                                 FW_SGraphicContext& gc, 
  133.                                 FW_SRect& bounds);
  134. void                SL_API    FW_PrivBitmap_GetBitmapBounds(FW_HBitmap bitmap, 
  135.                                 FW_SRect& bounds);
  136.  
  137. // Changing the bitmap
  138.  
  139. FW_PlatformError    SL_API    FW_PrivBitmap_ChangeBitmap(FW_HBitmap     bitmap,
  140.                                 void*        image,
  141.                                 long        imageSize,
  142.                                 short        rowBytes,
  143.                                 short        width,
  144.                                 short        height, 
  145.                                 short        pixelSize,
  146.                                 FW_Boolean    bScale);
  147.  
  148. FW_PlatformError    SL_API FW_PrivBitmap_ChangeBitmapGeometry(FW_HBitmap     bitmap,
  149.                                 short        width,
  150.                                 short        height, 
  151.                                 short        pixelSize,
  152.                                 FW_Boolean    bScale);
  153.                                     
  154. FW_PlatformError    SL_API    FW_PrivBitmap_SetImage(FW_HBitmap bitmap, 
  155.                                 void* image, 
  156.                                 long imageSize, 
  157.                                 short rowBytes);
  158.  
  159. // Copy Pixels
  160.  
  161. FW_PlatformError    SL_API    FW_PrivBitmap_CopyPixels(FW_HBitmap    bitmapSrc, 
  162.                                 FW_HBitmap    bitmapDst,
  163.                                 FW_SRect&     boundsSrc, 
  164.                                 FW_SRect&    boundsDst);
  165.  
  166. // Macintosh specific
  167.  
  168. #ifdef FW_BUILD_MAC
  169.  
  170. // Conversion
  171.  
  172. FW_HBitmap            SL_API    FW_PrivBitmap_MacCreateFromPicture(FW_HPicture picture, 
  173.                                 FW_SColor fillColor,
  174.                                 const FW_SRect& pictPart, 
  175.                                 FW_PlatformError* error);
  176.  
  177. FW_HPicture            SL_API    FW_PrivBitmap_MacGetAsPicture(FW_HBitmap bitmap, 
  178.                                 const FW_SRect& bounds, 
  179.                                 FW_PlatformError* error);
  180.  
  181. PixMapHandle        SL_API    FW_PrivBitmap_MacLockPixels(FW_HBitmap bitmap);    // return NULL if fails
  182. FW_PlatformError    SL_API    FW_PrivBitmap_MacUnlockPixels(FW_HBitmap bitmap);
  183. FW_Boolean            SL_API    FW_PrivBitmap_MacIsPixelsLocked(FW_HBitmap bitmap);
  184.  
  185. #endif
  186.  
  187. FW_EXTERN_C_END
  188.  
  189. // For CFM-68K [sfu]
  190.  
  191. #if defined(FW_ODFLIB_IMPORT)
  192. #pragma import off
  193. #elif defined(FW_ODFLIB)
  194. #pragma export off
  195. #endif
  196.  
  197. #endif // SLBITMAP_H
  198.